﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Animation.Resources;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
 

namespace Animation
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            Canvas c = new Canvas();
            c.Background = new SolidColorBrush(Colors.Green);
            this.Content = c;

            Rectangle rec = new Rectangle();
            rec.Width = 100.0;
            rec.Height = 100.0;
            rec.Fill = new SolidColorBrush(Colors.Yellow);
            //rec.Canvas.Top = 10.0;
            rec.SetValue(Canvas.TopProperty, 100.0);
            //rec.SetValue(Canvas.LeftProperty, 100.0);

            DoubleAnimation doubleAnime = new DoubleAnimation();
            doubleAnime.From = 0.0;
            doubleAnime.To = 100.0;
            doubleAnime.Duration = new Duration(TimeSpan.FromSeconds(2.0));

            Storyboard.SetTarget(doubleAnime,rec);
            Storyboard.SetTargetProperty(doubleAnime, new PropertyPath("(Canvas.Left)"));

            Storyboard myStory = new Storyboard();
            myStory.RepeatBehavior = new RepeatBehavior(100.0);
            myStory.Children.Add(doubleAnime);
            myStory.Begin();
            


            c.Children.Add(rec);
           
        }

    }
}